#include <stdio.h>

float average(int array[], int n);

void print_array(int array[], int n)
{
    int i = 0;
    printf("array: ");
    for(i = 0; i < n; i++)
        printf("%d,", array[i]);
    printf("\n");
}

int main(void)
{
    int score1[10] = {1,2,3,4};
    int score2[10] = {3,4,5,6};
    int n = 10;
    printf("score1=%p, score2=%p\n", score1, score2);
    printf("&score1[3] = %p\n", &score1[3]);
    print_array(score1, 10);
    float avg = average(score1, n);
    print_array(score1, 10);
    printf("n=%d\n", n);
    printf("avg=%f\n", avg);
    return 0;
}

float average(int array[], int n)
{
    printf("average(): array=%p\n", array);
    printf("average(): &array[3]=%p\n", &array[3]);
    float sum = array[0];
    int i = 0;
    for(i = 1; i < n; i++)
    {
        sum = sum + (float)array[i];
        array[i]  = -array[i];
    }
    float avg = sum / (float)n;
    n = n * 10;
    array = (unsigned long)array * 10;
    return avg;
}